<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fn' uri="http://java.sun.com/jsp/jstl/functions"%>

<%@ include file="../cabecalho.jsp"%>

<link href="<c:url value='/'/>/css/jquery-ui.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="<c:url value='/'/>/js/gdl.js"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value='/'/>/js/interface.js"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value='/'/>/js/jquery-ui.js"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value='/'/>/js/dateFormat.js"></script>

<script type="text/javascript">
	jQuery(function($) {
		$("input.data").mask("99/99/9999", {
			placeholder : ""
		});
	});
	jQuery(function($) {
		$("#ano").mask("9999", {
			placeholder : ""
		});
	});
	
	$(function() {
		$(".column").sortable({
			connectWith : '.column',
			handle : $(".portlet-header")
		});

		$(".portlet").addClass(
				"ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
				.find(".portlet-header").addClass(
						"ui-widget-header ui-corner-all").prepend(
						'<span class="ui-icon ui-icon-minusthick"></span>')
				.end().find(".portlet-content");

		$(".portlet-header .ui-icon").click(
				function() {
					$(this).toggleClass("ui-icon-minusthick").toggleClass(
							"ui-icon-plusthick");
					$(this).parents(".portlet:first").find(".tabelaDiv")
							.toggle();
				});

		/*$(".column").disableSelection();*/
		$.datepicker.setDefaults($.datepicker.regional['pt-BR']);
		$("#calendario").datepicker({
			maxDate : '+1m',
			onSelect : exibeAtividades
		});
	});

	function exibeAtividades(data) {

	}

	$.ajaxSetup({
		cache : false
	});
</script>

<center>
	<h1>
		<fmt:message key="cadastro_area_pesquisa_titulo_cadastro" />
	</h1>
</center>

<%-- !-- AREAS DE INTERESSE --%>
<div id="formAreaInteresse" class="form_cadastro">
	<form
		action="<c:url value='/secretaria/adicionaAreaDePesquisa'/>"
		method="post">
 
		<input type="hidden" name="areaDePesquisa.areaDePesquisaID"
			value="${areaDePesquisa.areaDePesquisaID}" maxlength=120 />

		<fieldset>
			<legend>
				<b><fmt:message key="cadastro_area_pesquisa_titulo_informacoes" /> </b>
			</legend>
			
			<div class="row">
				<div class="label">
					<fmt:message key="cadastro_area_pesquisa_nome" />
				</div>
				<span class="formw"><input type="text"
					name="areaDePesquisa.nome" value="${areaDePesquisa.nome}" />
				</span>
			</div>
			<div class='row'>
				<input type="submit" value='<fmt:message key="${acao}" />'/> 
				<c:if test="${acao == 'editar'}">
					<a href="<c:url value='/secretaria/adicionaAreaDePesquisa'/>">
						<input type="button" value="<fmt:message key="cancelar" />" />
					</a>
				</c:if> 
			</div>
		</fieldset>
	</form>

	<div class="column" style="width: 100%">
		<div class="portlet">
			<div class="portlet-header">
				<fmt:message key="cadastro_area_pesquisa_titulo_areas_cadastradas">
					<fmt:param value="${fn:length(areasDePesquisas)}" />
				</fmt:message>
			</div>

			<div class="tabelaDiv maior">
				<table class="tabela" cellpadding="5px" cellspacing="0"
					id="tableFormacao">
					<tr>
						<th><b><fmt:message
									key="cadastro_area_pesquisa_tabela_titulo_nome_area" /> </b>
						</th>
					</tr>

					<c:forEach var="area" items="${areasDePesquisas}"
						varStatus="rowCounter">
						<c:choose>
							<c:when test="${rowCounter.count % 2 == 0}">
								<c:set var="rowStyle" scope="page" value="odd" />
							</c:when>
							<c:otherwise>
								<c:set var="rowStyle" scope="page" value="even" />
							</c:otherwise>
						</c:choose>
						<tr class="${rowStyle}">
							<td>${area.nome}</td>
							<td><a
								href="<c:url value='/secretaria/editarAreaDePesquisa/${area.areaDePesquisaID}'/>">
									<img src="<c:url value='/images/editar.png'/>"
									alt='<fmt:message key="editar"/>'
									title="<fmt:message key="editar"/>" /> </a>
							<td>
							<td><a
								    href="<c:url value='/secretaria/removerAreaPesquisa/${area.areaDePesquisaID}'/>">
									<img src="<c:url value='/images/excluir.gif'/>"
									alt='<fmt:message key="excluir"/>'
									title="<fmt:message key="excluir"/>"
									onclick="return confirm('<fmt:message
										key="tem_certeza_excluir" />');"/> </a>
							<td>
						</tr>
					</c:forEach>
				</table>
			</div>
		</div>
	</div>
	<div class=clear></div>
</div> 

<%@ include file="../rodape.jsp"%>